﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using InformaticaDiary.InformaticaDiaryUI.Class;
using InformaticaDiary.Common;

namespace InformaticaDiary.InformaticaDiaryUI
{
    public partial class MainForm : Form
    {
        BussinessLogic objBussinessLogic = new BussinessLogic();
        public MainForm()
        {
            InitializeComponent();
        }

        private void MainForm_Load(object sender, EventArgs e)
        {

        }

        private void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtPassword.Text.Trim() == "" )
                {
                    MessageBox.Show(this,"Please enter user name to continue.","Login",MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                if (txtPassword.Text.Trim() == "")
                {
                    MessageBox.Show(this, "Please enter password to continue.", "Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                LoginRequest objRequest = new LoginRequest();
                objRequest.Password = txtPassword.Text;
                objRequest.UserName = txtUserName.Text.Trim();
                ExecutedResult obj = objBussinessLogic.Login(objRequest);
                if (obj.ErrorNo == 0)
                {
                }
                else
                {
                    MessageBox.Show(this, obj.ErrorDesc, "Login", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
            }
        }

       
    }
}
